/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set expandtab shiftwidth=4 tabstop=4: */

#include <stdint.h>
#include "XorHashMacro.h"
/** \brief integer hash by Thomas Wang using multiplication
 *
 *
 * License: Public domain?
 */
class ThomasWangHash32_mult
{

public:
    const char* name() const
    {
        return "ThomasWang_mult";
    }

    uint32_t hash32(uint32_t key) const
    {
        const uint32_t c2 = 0x27d4eb2d; // a prime or an odd constant
        key = (key ^ 61) ^ (key >> 16);
        key = key + (key << 3);
        key = key ^ (key >> 4);
        key = key * c2;
        key = key ^ (key >> 15);
        return key;
    }

    XORHASH
};
